import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getwidget/components/avatar/gf_avatar.dart';
import 'package:getwidget/components/checkbox_list_tile/gf_checkbox_list_tile.dart';
import 'package:getwidget/types/gf_checkbox_type.dart';

import '../controllers/gfcheckboxlisttile_controller.dart';

class GfcheckboxlisttileView extends GetView<GfcheckboxlisttileController> {
  String avatarPath = 'assets/images/cliu.jpg';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('复选框列表'),
        centerTitle: true,
      ),
      body: Container(
        child: ListView(
          children: [
            Obx(() {
              return GFCheckboxListTile(
                titleText: '初六',
                subTitleText: '懂二进制的男人',
                avatar: GFAvatar(
                  backgroundImage: AssetImage(avatarPath),
                ),
                size: 25,
                activeBgColor: Colors.green,
                type: GFCheckboxType.circle,
                activeIcon: Icon(
                  Icons.check,
                  size: 15,
                  color: Colors.white,
                ),
                onChanged: (value) {
                  controller.isChecked.value = value;
                },
                value: controller.isChecked.value,
                inactiveIcon: null,
              );
            })
            
          ],
        ),
      ),
    );
  }
}
